import request from '/@/utils/request';

export function userApi() {
    return {
        createUser: (data: object) => {
            return request({
                url: 'sys/user/create',
                method: 'POST',
                data,
            });
        },
        updateUser: (data: object) => {
            return request({
                url: 'sys/user/update',
                method: 'PUT',
                data,
            });
        },
        deleteUser: (id: any) => {
            return request({
                url: `sys/user/delete/${id}`,
                method: 'DELETE',
            });
        },
        batchDeleteUser: (data: object) => {
            return request({
                url: 'sys/user/batchdelete',
                method: 'POST',
                data,
            });
        },
        viewUser: (id: any) => {
            return request({
                url: `sys/user/view/${id}`,
                method: 'GET',
            });
        },
        searchUser: (data: object) => {
            return request({
                url: 'sys/user/search',
                method: 'POST',
                data,
            });
        },
        userRoleIdsByUserId: (id: any) => {
            return request({
                url: `sys/user/roles/${id}`,
                method: 'GET',
            });
        },
        createUserRoles: (data: object) => {
            return request({
                url: 'sys/user/createuserrole',
                method: 'POST',
                data,
            });
        },

        resetPassword: (data: object) => {
            return request({
                url: 'sys/user/reset/password',
                method: 'POST',
                data
            })
        }

    };
}
